@extends('layouts.header')
@section('title','短信发送详情')
@section('content')
    <article class="page-container">
        <form class="form form-horizontal" id="form" autocomplete="off">
            <div class="row cl">
                <label class="form-label col-xs-3">总条数：</label>
                <div class="formControls col-xs-9">
                    {{isset($data['TotalCount']) ? $data['TotalCount'] : 0}}条
                </div>
            </div>
            @if($data['Code'] !== 'OK' || $data['Message'] !== 'OK')
            <div class="row cl">
                <label class="form-label col-xs-3">请求状态：</label>
                <div class="formControls col-xs-9">
                    {{$data['Code']}}
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-3">错误描述：</label>
                <div class="formControls col-xs-9">
                    {{$data['Message']}}
                </div>
            </div>
            @endif
            <div class="row cl">
                <label class="form-label col-xs-2">短信发送明细：</label>
                <div class="formControls col-xs-9">
                    <table class="table table-border table-bordered table-hover table-bg table-responsive mr-20" id="datatable"
                            {{--                           style="white-space: nowrap;"--}}
                    >
                        <thead>
                        <tr class="text-c">
                            <th>短信内容</th>
                            <th>
                                运营商短信状态码
                                <br>
                                <span class="c-333 size-MINI">短信发送成功：DELIVERED。</span>
                            </th>
                            <th>接收短信的手机号码</th>
                            <th>短信接收日期和时间</th>
                            <th>短信发送日期和时间</th>
                            <th>短信发送状态</th>
                            <th>短信模板ID</th>
                        </tr>
                        </thead>
                        <tbody>
                        @if(isset($data['SmsSendDetailDTOs']['SmsSendDetailDTO']))
                            @foreach($data['SmsSendDetailDTOs']['SmsSendDetailDTO'] as $item)
                                <tr class="text-c">
                                    <td>{{$item['Content']}}</td>
                                    <td>{{isset($item['ErrCode']) ? $item['ErrCode'] : '--'}}</td>
                                    <td>{{isset($item['PhoneNum']) ? $item['PhoneNum'] : '--'}}</td>
                                    <td>{{isset($item['ReceiveDate']) ? $item['ReceiveDate'] : '--'}}</td>
                                    <td>{{isset($item['SendDate']) ? $item['SendDate'] : '--'}}</td>
                                    <td>{{isset($item['SendStatus']) ? ($item['SendStatus'] == 1 ? '等待回执' :($item['SendStatus'] == 2 ? '发送失败' : '发送成功')) : '--'}}</td>
                                    <td>{{isset($item['TemplateCode']) ? $item['TemplateCode'] : '--'}}</td>
                                </tr>
                            @endforeach
                        @endif
                        </tbody>
                    </table>

                </div>
            </div>
        </form>
    </article>

    <script type="text/javascript">
        $.fn.dataTable.ext.errMode = 'throw';//datatable抛异常的方式，在console中输出，默认以alert的方式弹出
        $('#datatable').DataTable({
            paging: false, //禁用分页
            ordering: false, // 是否排序
            info: false, //禁用分页详情
            searching: false,
            scrollX: true
        });
        $('.layui-layer-close').on('click', function () {
            parent.table_reload(false);
        })
    </script>
@endsection
